package com.deprice4u;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;


public class SocialSearchAdapter extends BaseAdapter {
	private Context mContext;
	private LayoutInflater mInflater;
	private int mLayout;
	private ArrayList<SocialData> maListItems;
	
	public SocialSearchAdapter(Context context, int nLayout, ArrayList<SocialData> aListItems){
		mContext = context;
		mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		maListItems = aListItems;
		mLayout = nLayout;
	}

	public int getCount() {
		return maListItems.size();
	}

	public Object getItem(int nPos) {
		// TODO Need to bo fixed!
		return maListItems.get(nPos).title;
	}

	public long getItemId(int nPos) {
		// TODO Need to bo fixed!
		return nPos;
	}

	public View getView(int nPos, View convertView, ViewGroup parent) {
		if(convertView == null){
			convertView = mInflater.inflate(mLayout, parent, false);
		}
		
		TextView txtTitle = (TextView)convertView.findViewById(R.id.listItemTitle);
		txtTitle.setText(maListItems.get(nPos).title);
		
		return convertView;
	}

}
